import { modal } from 'vue-strap'
import { showMsg } from '../../../../../vuex/action.js'

export default {
  data() {
    return {
      showSwapPortfolioModal: false,
      name: '',
      image: '',
      org: '',
      cardNum: ''
    }
  },
  methods: {
    trim(inStr) {
      return inStr.replace(/(^ +)|( +$)/g, '')
    },
    checkValid() {
      if (this.name.length === 0) {
        return '请输入投顾姓名'
      } else if (this.org.length === 0) {
        return '请添加投顾人机构'
      } else if (this.cardNum.length === 0) {
        return '请添加执业证编号'
      }
    },
    addInverstorInfo() {
      let validMsg = this.checkValid()
      if (validMsg) {
        return this.xShowMsg({
          type: 'danger',
          content: validMsg
        })
      }

      let formData = new FormData()
      // let imageFile = this.$els.addImage.files[0]
      formData.append('name', this.name)
      formData.append('img', this.$els.addImage.files[0])
      formData.append('org', this.org)
      formData.append('cardNum', this.cardNum)
    // this.xAddInverstorInfo(formData)
    //   .then((res) => {
    //    this.showAddMoneyTypeModal = false
    //  })
    }
  },
  components: {
    modal: modal
  },
  vuex: {
    actions: {
      xShowMsg: showMsg
    }
  }
}
